unit PagarLan;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, StdCtrls, Mask, DBCtrls, Buttons, ComCtrls, ExtCtrls;

type
  TfrmPagarLan = class(TForm)
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Panel1: TPanel;
    Panel2: TPanel;
    Panel3: TPanel;
    StatusBar1: TStatusBar;
    Label1: TLabel;
    Label5: TLabel;
    DBEditValorRec: TDBEdit;
    DBEditDataRec: TDBEdit;
    Label6: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label7: TLabel;
    DBLookupComboBoxFormaPagamento: TDBLookupComboBox;
    DBEditJuros: TDBEdit;
    Label8: TLabel;
    Label4: TLabel;
    DBEditTitulo: TDBEdit;
    DBEditParcelas: TDBEdit;
    DBEditVencimento: TDBEdit;
    DBEditValor: TDBEdit;
    DsListaPagamentos: TDataSource;
    Label9: TLabel;
  private
    { Private declarations }
  public
    procedure SetDataSource(fonte: TDataSource);
    procedure PrepararBaixa;
    procedure PrepararAlteracao;
  end;

var
  frmPagarLan: TfrmPagarLan;

implementation

uses DmGeral;

{$R *.dfm}

{ TFrmLancTitulos }

procedure TfrmPagarLan.PrepararAlteracao;
begin
  DBEditTitulo.Enabled                  := false;
  DBEditTitulo.Brush.Color              := $00E4E7CD;
  DBEditParcelas.Enabled                := false;
  DBEditParcelas.Brush.Color            := $00E4E7CD;
  DBEditVencimento.Enabled              := true;
  DBEditValor.Enabled                   := true;
  DBEditValorRec.Enabled                := true;
  DBEditDataRec.Enabled                 := true;
  DBLookupComboBoxFormaPagamento.Enabled:= true;
  DBEditJuros.Enabled                   := true;
end;

procedure TfrmPagarLan.PrepararBaixa;
begin
  DBEditTitulo.Enabled                  := false;
  DBEditTitulo.Brush.Color              := $00E4E7CD;
  DBEditParcelas.Enabled                := false;
  DBEditParcelas.Brush.Color            := $00E4E7CD;
  DBEditVencimento.Enabled              := false;
  DBEditVencimento.Brush.Color          := $00E4E7CD;
  DBEditValor.Enabled                   := false;
  DBEditValor.Brush.Color               := $00E4E7CD;
  DBEditValorRec.Enabled                := true;
  DBEditDataRec.Enabled                 := true;
  DBLookupComboBoxFormaPagamento.Enabled:= true;
  DBEditJuros.Enabled                   := true;
end;

procedure TfrmPagarLan.SetDataSource(fonte: TDataSource);
begin
  DBEditValorRec.DataSource                 := fonte;
  DBEditDataRec.DataSource                  := fonte;
  DBLookupComboBoxFormaPagamento.DataSource := fonte;
  DBEditJuros.DataSource                    := fonte;
  DBEditParcelas.DataSource                 := fonte;
  DBEditVencimento.DataSource               := fonte;
  DBEditValor.DataSource                    := fonte;
end;

end.
